package com.sun.androidexerciseproject.function.java;

import java.util.Stack;
import java.util.StringTokenizer;

/**
 * Created by Steven on 2017/2/27 0027.
 */

public class StackTest {
    public static void main(String[] args) {
        Stack<String> stack = new Stack<>();
        //set
        stack.add("1");
        stack.add("2");
        stack.add("3");

        int size = stack.size();
        System.out.println("size1 = " + size);
        stack.push("4");
        String str = stack.peek();
        size = stack.size();
        System.out.println("str = " + str);
        System.out.println("size2 = " + size);
        str = stack.pop();
        size = stack.size();
        System.out.println("str1 = " + str);
        System.out.println("size3 = " + size);
        stack.clear();
        size = stack.size();
        System.out.println("size4 = " + size);
        StringTokenizer stringTokenizer = new StringTokenizer("Hello World!", " ");
        System.out.println(stringTokenizer.nextToken());
    }
}
